import Vue from 'vue'
import Vuex from 'vuex'


import vuexPersist from 'vuex-persist'
import myPlugin from 'vuex-persistence'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 复制的文本保存记录
    copeHistory: [],
    todoname:'',
  },
  getters: {
  },
  mutations: {
    pushHistory(state, history) {
      state.copeHistory.unshift(history)
      console.log('数据打印-data',null,JSON.parse(JSON.stringify(history)));
    },
    clearHistory(state) {
      state.copeHistory = []
    },
    saveName(store,name) {
      store.todoname = name
    }
    
  },
  actions: {
  },
  modules: {
  },
  plugins: [
    new vuexPersist({
      storage: window.localStorage,
    }).plugin,
  ],
})
